package translation;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.util.Scanner;

public class Wenzichuli {
	public static void main(String[] args) {
	StringBuffer a = new StringBuffer("汉皇重色思倾国御宇多年求不得杨家有女初长成养在深闺人未识天生丽质难自弃一朝选在君王侧回眸一笑百媚生六宫粉黛无颜色春寒赐浴华清池温泉水滑洗凝脂侍儿扶起娇无力始是新承恩泽时云鬓花颜金步摇芙蓉帐暖度春宵春宵苦短日高起从此君王不早朝承欢侍宴无闲暇春从春游夜专夜后宫佳丽三千人三千宠爱在一身金屋妆成娇侍夜玉楼宴罢醉和春姊妹弟兄皆列士可怜光采生门户遂令天下父母心不重生男重生女骊宫高处入青云仙乐风飘处处闻缓歌慢舞凝丝竹尽日君王看不足渔阳鼙鼓动地来惊破霓裳羽衣曲九重城阙烟尘生千乘万骑西南行");
	for (int j = 7;j<a.length();j+=15) {
        a.insert(j, "，");//从第八个组为第一个添加逗号的地方，而后每隔7位，即在第八位添加逗号
    }
 for (int i = 15;i<a.length();i+=16) {
        a.insert(i, "。");
       }
    for (int c = 16;c<a.length();c+=17) {
       a.insert(c, "\n");
       }
    System.out.print(a);
    
    //查询是否出现
    System.out.print("请输入需要检索的单词:");
    try (Scanner sc = new Scanner(System.in)) {
		String word = sc.next();
		int ind=0;
		int t=0;
		while(a.indexOf(word,ind)>=0){
		    t++;
		    ind=a.indexOf(word,ind)+word.length();
		}
		System.out.println(word+"出现的次数为:"+t);
	}
	}
{}}
//写入文件当中 


